from django.http import JsonResponse
from django.views.generic import View
import threading
import os


class Chat(View):
    TEMPLATE = 'client/video/video.html'

    def get(self, request):
        print('run')
        threading.Thread(target=a, args=(request.session['username'],)).start()
        print('end')
        return JsonResponse()


def a(username):
    print('username:', username)
    os.system(r"python D:\PycharmProjects\video\app\client\views\chat_client.py "+username)
    # conn = telnetlib.Telnet()
    # login(conn)


